package Service;

import java.util.List;
import java.util.Random;

import Config.GlobalVariables;
import Entity.InboundCounter;
import Entity.Orders;
import Entity.OutboundCounter;

public class RandomDelivery {
    // TODO: 实现随机订单的功能实现
    private static final List<String> PRODUCT_NAMES = List.of("ProductA", "ProductB", "ProductC", "ProductD");
    private static final List<String> CATEGORIES = List.of("Electronics", "Furniture", "Clothing", "Toys");
    private static final List<OutboundCounter> COUNTERS = List.of(
            GlobalVariables.outboundCounter1, GlobalVariables.outboundCounter2,
            GlobalVariables.outboundCounter3, GlobalVariables.outboundCounter4);
    private static final int MAX_GROUP_ID = 10; // 最大组标识符
    private static final int MAX_STOCK = 50; // 最大库存数量
    private static final Random RANDOM = new Random();

    // 随机生成订单
    public static Orders generateOrder() {
        String name = PRODUCT_NAMES.get(RANDOM.nextInt(PRODUCT_NAMES.size()));
        String category = CATEGORIES.get(RANDOM.nextInt(CATEGORIES.size()));
        int groupId = RANDOM.nextInt(MAX_GROUP_ID) + 1; // 生成 1 到 MAX_GROUP_ID 的组标识符
        int stock = RANDOM.nextInt(MAX_STOCK) + 1; // 随机库存数量
        OutboundCounter counter = COUNTERS.get(RANDOM.nextInt(COUNTERS.size()));

        return new Orders(name, category, groupId, 1, counter);
    }
}
